package com.googlecode.horncomb.orm.ibatis.plugins;

import java.lang.reflect.Field;

/**
 * ReflectUtil.
 * @author RUN
 */
public class ReflectUtil {
	/**
	 * Get the value of a field in an object.
	 * @param obj
	 *            the object to look at.
	 * @param fieldName
	 *            the name of the field in the object.
	 * @return the value of the field.
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public static Object getField(Object obj, String fieldName)
			throws IllegalAccessException, NoSuchFieldException {
		Field field = obj.getClass().getDeclaredField(fieldName);
		field.setAccessible(true);
		return field.get(obj);
	}
}
